
************************************************************************************************************
*Replication*

*The Reach of the State*

*Charles Chang and Yuhua Wang*

*Comparative Political Studies*

*Updated on July 7, 2023*

*This do file contains the code that produces Tables A1-3, A1-4, and A1-6 in the Online Appendix*

*Stata 18.0*
************************************************************************************************************

*Change this to your local folder*
cd "/Users/ywang/Library/CloudStorage/Dropbox/Project on Police Stations/Baidu POI/Journal submission/cps/Final/replication package/"

log using "Tables A1-3 and A1-4 and A1-6.log" 

*********************************************************************
*Table A1-3: Coercion and Protest: DID Estimates with County-Level Data
*********************************************************************

set more off

use "protest_state_county_panel.dta", clear

xi: reg protest_half y2017_stability_dummy y2015_stability_dummy y2015 y2017 i.countyid if year==2017 | year==2015 | year==2013,cl(countyid)
estimates store protest_stability
estadd ysumm

esttab protest_stability using protest_stability_integrated.tex, ///
	replace fragment keep(y2017_stability_dummy y2015_stability_dummy y2017 y2015) ///
	b(3) se(3) posthead(\cmidrule(lr){2}) ///
	cells(b(star fmt(3)) se(fmt(3) par)) staraux star(* 0.10 ** 0.05 *** 0.01) collabels(none) ///
	label booktabs noconstant obslast nodepvars nomtitles nolines gaps ///
	scalars("r2 \(R^{2}\)") sfmt(3) ///
	stats(ymean ysd N r2, fmt(3 3 0 3) labels("Outcome mean" "Outcome std.dev." "Observations" "R2")) ///
	indicate("County FE = *countyid*")
	
	
*Copy and paste the following data into the Stata data file "DiD graph data.dta" for DiD graph in R*

*year	treat	protest
*2013	0	3.076778
*2015	0	2.726872
*2017	0	0.782253
*2013	1	4.967379
*2015	1	4.316085
*2017	1	1.289089
*2013	2	4.967379
*2015	2	4.316085
*2017	2	2.371466

clear

*********************************************************************	
*Table A1-4: State Agencies and Protest: DID Estimates with County-Level Data
*********************************************************************

set more off

use "protest_state_county_panel.dta", clear

xi: reg protest_half y2017_county_admin_dummy y2015_county_admin_dummy y2015 y2017 i.countyid if year==2017 | year==2015 | year==2013,cl(countyid)
estimates store placebo1
estadd ysumm
xi: reg protest_half y2017_court_dummy y2015_court_dummy y2015 y2017 i.countyid if year==2017 | year==2015 | year==2013,cl(countyid)
estimates store placebo2
estadd ysumm
xi: reg protest_half y2017_industrycommerce_dummy y2015_industrycommerce_dummy y2015 y2017 i.countyid if year==2017 | year==2015 | year==2013,cl(countyid)
estimates store placebo3
estadd ysumm
xi: reg protest_half y2017_statetax_dummy y2015_statetax_dummy y2015 y2017 i.countyid if year==2017 | year==2015 | year==2013,cl(countyid)
estimates store placebo4
estadd ysumm


esttab placebo1 placebo2 placebo3 placebo4 using placebo.tex, ///
	replace fragment keep(y2017_county_admin_dummy y2015_county_admin_dummy y2017_court_dummy y2015_court_dummy y2017_industrycommerce_dummy y2015_industrycommerce_dummy y2017_statetax_dummy y2015_statetax_dummy y2015 y2017) ///
	order(y2017_county_admin_dummy y2015_county_admin_dummy y2017_court_dummy y2015_court_dummy y2017_industrycommerce_dummy y2015_industrycommerce_dummy y2017_statetax_dummy y2015_statetax_dummy y2015 y2017) ///
	b(3) se(3) posthead(\cmidrule(lr){2-5}) ///
	cells(b(star fmt(3)) se(fmt(3) par)) staraux star(* 0.10 ** 0.05 *** 0.01) collabels(none) ///
	label booktabs noconstant obslast nodepvars nomtitles nolines gaps ///
	scalars("r2 \(R^{2}\)") sfmt(3) ///
	stats(ymean ysd N r2, fmt(3 3 0 3) labels("Outcome mean" "Outcome std.dev." "Observations" "R2")) ///
	indicate("County FE = *countyid*")
	
clear

*********************************************************************
*Table A1-6: Patterns of Missingness in World Bank Data: OLS Estimates
*********************************************************************

set more off

use "cross-national data.dta", clear

xi: reg publicemployee_missing polity2 pcgdp_log pc_num_gov_log pop_log,robust
estimates store missing
	estadd ysumm

esttab missing using missing.tex, ///
	replace fragment keep(polity2 pcgdp_log pc_num_gov_log pop_log) ///
	order(polity2 pcgdp_log pc_num_gov_log pop_log) ///
	b(3) se(3) posthead(\cmidrule(lr){2}) ///
	cells(b(star fmt(3)) se(fmt(3) par) ) staraux star(* 0.10 ** 0.05 *** 0.01) collabels(none) ///
	label booktabs noconstant obslast nodepvars nomtitles nolines gaps ///
	scalars("r2 \(R^{2}\)") sfmt(3)


log close

clear

exit

